import js from "@eslint/js"
import globals from "globals"
import { defineConfig } from "eslint/config"

export default defineConfig([
  {
    ignores: ['dist/**', 'jest.config.js', 'eslint.config.mjs', 'src/renderer/**',],
  },
  {
    files: ["**/*.{js,mjs,cjs}"],
    plugins: { js },
    extends: ["js/recommended"],
    rules: {
      indent: "off",
      quotes: ["error", "single", { avoidEscape: true }],
      "no-unused-vars": ["error", { args: "none", ignoreRestSiblings: true }],
      "no-console": "off",
      eqeqeq: "error",
      curly: "error",
      "no-undef": "error",
      "no-redeclare": "error",
      "consistent-return": "error",
      "no-shadow": "error",
      "object-curly-spacing": ["error", "always"],
      "callback-return": "error",
      "handle-callback-err": ["error", "^.*(e|E)rr"],
      "no-new-require": "error",
      "no-path-concat": "error",
      "no-process-exit": "off",
      "no-eval": "error",
      "no-implied-eval": "error",
      strict: "error",
      "no-var": "error",
      "prefer-const": "error",
      "no-empty": "error",
      "no-mixed-operators": "error",
      "no-trailing-spaces": "error",
      "linebreak-style": "off",
      "max-len": "off",
      "no-param-reassign": "off",
      "prefer-destructuring": "off",
      "prefer-arrow-callback": "off",
      "func-names": "error",
      "arrow-parens": "off",
      "dot-notation": "off",
      "import/prefer-default-export": "off",
      "import/first": "off",
      "no-template-curly-in-string": "off",
      "new-cap": ["error", { capIsNew: false }],
      "array-callback-return": "error",
      "object-shorthand": ["error", "consistent"],
      "function-paren-newline": ["error", "consistent"],
      "quote-props": ["error", "as-needed"],
      "operator-linebreak": ["error", "before"],
      "prefer-template": "error",
      "id-length": "error",
      "newline-before-return": "error",
      "space-before-blocks": "error",
      "eol-last": ["error", "always"],
      "no-multiple-empty-lines": ["error", { max: 1, maxEOF: 1 }]
    }
  },
  {
    files: ["**/*.js"],
    languageOptions: { sourceType: "commonjs" }
  },
  {
    files: ["**/*.{js,mjs,cjs}"],
    languageOptions: {
      globals: {
        ...globals.browser,
        ...globals.node,
        ...globals.jest
      }
    }
  }
])
